<template>
    <div>
        所有商品
        <table >
            <tr>
                <td>商品id</td>
                <td>商品名称</td>
                <td>商品分类</td>
            </tr>
            <tr v-for="i in glist">
                <td>{{i.id}}</td>
                <td>{{i.name}}</td>
                <td>
                    <button @click="cate(i.cate)">{{i.cate}}</button>
                    </td>
            </tr>
        </table>
        {{glist}}

    </div>
</template>

<script>
    export default {
        data(){
            return{
                glist:[],
                uid:0,
               
                
            }
        },
        methods:{
            get_glist(cate){
                this.$axios.get('good?cate='+cate+'&uid='+this.uid)
                .then(res=>{
                    this.glist=res.data.list
                })
            },
            cate(cate){
                this.uid=1
                this.get_glist(cate)
            },
        },
        mounted(){
            this.get_glist()
        },
    }
</script>

<style scoped>

</style>